package com.hezhiqin.xiancheng;

/**
 * @program: homeWork
 * @description:
 * @author: hezhiqin
 * @create: 2019-12-05 14:52
 */
public class VolatileDemo {

//    public volatile static boolean stop=false;

    public  static boolean stop=false;

    public static void main(String[] args) throws InterruptedException {
        Thread thread=new Thread(()->{
            int i=0;
            while(!stop){
                i++;
            }
        });
        thread.start();
        System.out.println("begin start thread");
        Thread.sleep(1000);
        stop=true;
    }
}
